<template>
  <div class="exception">
    <div class="img">
      <img :src="config[type].img"/>
    </div>
    <div class="content">
      <h1>{{ config[type].title }}</h1>
      <div class="desc">{{ config[type].desc }}</div>
      <div class="action">
        <a-button type="primary" @click="handleToHome">{{ $t('homepage') }}</a-button>
      </div>
    </div>
  </div>
</template>

<i18n>
  {
    "zh-CN": {
      "homepage": "返回首页",
      "403":"抱歉，你无权访问该页面",
      "404":"抱歉，你访问的页面不存在或无权访问",
      "500":"抱歉，服务器出错了"
    },
    "en-US": {
      "homepage": "Back Home",
      "403":"Sorry, you do not have access to this page",
      "404":"Sorry, the page you are visiting does not exist or you do not have permission to access it",
      "500":"Sorry, there was an error on the server"
    },
    "fr-FR": {
      "homepage": "Retour à la page d'accueil",
      "403":"Désolé, vous n'êtes pas autorisé à accéder à cette page",
      "404":"Désolé, la page que vous visitez n'existe pas ou n'est pas accessible",
      "500":"Désolé, erreur de serveur"
    }
  }
</i18n>

<script>
  import types from './type'
  export default {
    name: "Exception",
    props: {
      type: {
        type: String,
        default: '404'
      }
    },
    data() {
      return {
        config: types
      }
    },
    methods: {
      handleToHome () {
        // console.log("sta------------------:", this.$store.state.user.homeUrl)
        this.$router.push({ path: this.$store.state.user.homeUrl })
      }
    }
  }
</script>

<style lang="less" scoped>
  .exception {
    min-height: 500px;
    height: 80%;
    align-items: center;
    text-align: center;
    margin-top: 150px;
    .img {
      display: inline-block;
      padding-right: 52px;
      zoom: 1;
      img {
        height: 360px;
        max-width: 430px;
      }
    }
    .content {
      display: inline-block;
      flex: auto;
      h1 {
        color: #434e59;
        font-size: 72px;
        font-weight: 600;
        line-height: 72px;
        margin-bottom: 24px;
      }
      .desc {
        color: rgba(0, 0, 0, .45);
        font-size: 20px;
        line-height: 28px;
        margin-bottom: 16px;
      }
    }
  }

  .mobile {
    .exception {
      margin-top: 30px;
      .img {
        padding-right: unset;

        img {
          height: 40%;
          max-width: 80%;
        }
      }
    }
  }
</style>